/*
 * Copyright (C) 2017 Baidu, Inc. All Rights Reserved.
 */
package com.kfm.hotel.util;


import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.json.JsonMapper;
import org.apache.poi.ss.formula.functions.T;

import java.lang.reflect.Type;

/**
 * Json工具类.
 */
public class GsonUtils {

    private static ObjectMapper jackson = new ObjectMapper();

    public static String toJson(Object value) throws JsonProcessingException {
        return jackson.writeValueAsString(value);
    }

    public static <T> T fromJson(String json, Class<T> classOfT) throws JsonProcessingException {
        return jackson.readValue(json, classOfT);
    }

}
